home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Freeware / First Page 2006 3.00 / fp2006-final-3.00-setup.exe / {app} / Iscripts / DHTML - User System / disabling-rightclick-2.izs < prev    next >
Text File  |  2005-09-02  |  3KB  |  114 lines

  1. <!NOWIZARD>
  2.  
  3. <!TITLE>Disable right mouse click script II (on images)
  4. <!/TITLE>
  5.  
  6. <!BROWSER>FF1+ IE5+<!/BROWSER>
  7.  
  8. <!DESCRIPTION> This alternate version of the original no right click script targets only images, so right clicking is disabled only when attempting to save an image on the page. Great if you wish your visitors to be able to access the default right menu in general cases.
  9. <!/DESCRIPTION> 
  10.  
  11. <!CATEGORY>text animations<!/CATEGORY>
  12.  
  13. <!SCRIPT>
  14. <!-- START OF SCRIPT -->
  15. <script language="JavaScript1.2">
  16.  
  17. /*
  18. Disable right click script II (on images)- By Dynamicdrive.com
  19. For full source, Terms of service, and 100s DTHML scripts
  20. Visit http://www.dynamicdrive.com
  21. */
  22.  
  23. var clickmessage="Right click disabled on images!"
  24.  
  25. function disableclick(e) {
  26. if (document.all) {
  27. if (event.button==2||event.button==3) {
  28. if (event.srcElement.tagName=="IMG"){
  29. alert(clickmessage);
  30. return false;
  31. }
  32. }
  33. }
  34. else if (document.layers) {
  35. if (e.which == 3) {
  36. alert(clickmessage);
  37. return false;
  38. }
  39. }
  40. else if (document.getElementById){
  41. if (e.which==3&&e.target.tagName=="IMG"){
  42. alert(clickmessage)
  43. return false
  44. }
  45. }
  46. }
  47.  
  48. function associateimages(){
  49. for(i=0;i<document.images.length;i++)
  50. document.images[i].onmousedown=disableclick;
  51. }
  52.  
  53. if (document.all)
  54. document.onmousedown=disableclick
  55. else if (document.getElementById)
  56. document.onmouseup=disableclick
  57. else if (document.layers)
  58. associateimages()
  59. </script>
  60. <!-- END OF SCRIPT -->
  61. <!/SCRIPT>
  62.  
  63. <!PREVIEW>
  64. <!-- START OF SCRIPT -->
  65.  
  66. <script language="JavaScript1.2">
  67.  
  68. /*
  69. Disable right click script II (on images)- By Dynamicdrive.com
  70. For full source, Terms of service, and 100s DTHML scripts
  71. Visit http://www.dynamicdrive.com
  72. */
  73.  
  74. var clickmessage="Right click disabled on images!"
  75.  
  76. function disableclick(e) {
  77. if (document.all) {
  78. if (event.button==2||event.button==3) {
  79. if (event.srcElement.tagName=="IMG"){
  80. alert(clickmessage);
  81. return false;
  82. }
  83. }
  84. }
  85. else if (document.layers) {
  86. if (e.which == 3) {
  87. alert(clickmessage);
  88. return false;
  89. }
  90. }
  91. else if (document.getElementById){
  92. if (e.which==3&&e.target.tagName=="IMG"){
  93. alert(clickmessage)
  94. return false
  95. }
  96. }
  97. }
  98.  
  99. function associateimages(){
  100. for(i=0;i<document.images.length;i++)
  101. document.images[i].onmousedown=disableclick;
  102. }
  103.  
  104. if (document.all)
  105. document.onmousedown=disableclick
  106. else if (document.getElementById)
  107. document.onmouseup=disableclick
  108. else if (document.layers)
  109. associateimages()
  110. </script>
  111. <!-- END OF SCRIPT -->
  112. <!/PREVIEW>
  113.  
  114. <!RELATED>NONE<!/RELATED>